package frame.impl;

import java.util.List;

import customerEnter.Frame.Enum.T_SQLConditionEnum;
import customerEnter.Frame.JDBCDao.daoFrame.SqlDataBaseController;
import customerEnter.tool.WhetherToEmpty;
import frame.interfaces.DaoFrameDMLBaseInterfaec;

public class DaoFrameDMLBaseImpl implements DaoFrameDMLBaseInterfaec<DaoFrameDMLBaseImpl> {

	private String		DataBase;

	private String		DML;

	private String		Front;

	private String		Rule;

	private String		TableName;

	private String		where;
	// --------------------------------begin查詢參數------------------
	private Class<?>	ClassName;

	private boolean		IfEhcache;

	private Object		Success;

	private Boolean		pagingParametersCount;

	private int			size;
	private int			page;
	private String		order;
	private String		descOrAsc;
	private boolean		isReturnId;

	// --------------------------------end查詢參數------------------
	// --------------------------------begin增刪改參數------------------
	private boolean		IfUpdate;
	/**
	 * 順序的 添加參數
	 */

	@SuppressWarnings("rawtypes")
	private List		values;
	/**
	 * 映射到數據表
	 */
	private Object		MappingObject;

	private Class<?>	class1;

	// --------------------------------end增刪改參數------------------

	public boolean isReturnId() {
		return isReturnId;
	}

	public void setReturnId(boolean isReturnId) {
		this.isReturnId = isReturnId;
	}

	public boolean isIfUpdate() {
		return IfUpdate;
	}

	public Class<?> getClass1() {
		return class1;
	}

	public void setClass1(Class<?> class1) {
		this.class1 = class1;
	}

	public Object getMappingObject() {
		return MappingObject;
	}

	public void setMappingObject(Object mappingObject) {
		MappingObject = mappingObject;
	}

	@SuppressWarnings("unchecked")
	public List<Object> getValues() {
		return values;
	}

	public void setValues(List<Object> values) {
		this.values = values;
	}

	public void setIfUpdate(boolean ifUpdate) {
		IfUpdate = ifUpdate;
	}

	private int	position;

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public String getDescOrAsc() {
		return descOrAsc;
	}

	public void setDescOrAsc(String descOrAsc) {
		this.descOrAsc = descOrAsc;
	}

	public String getDataBase() {
		return DataBase;
	}

	public void setDataBase(String dataBase) {
		DataBase = dataBase;
	}

	public String getDML() {
		return DML;
	}

	public void setDML(String dML) {
		DML = dML;
	}

	public String getFront() {
		return Front;
	}

	public void setFront(String front) {
		Front = front;
	}

	public String getRule() {
		return Rule;
	}

	public void setRule(String rule) {
		Rule = rule;
	}

	public String getTableName() {
		return TableName;
	}

	public void setTableName(String tableName) {
		TableName = tableName;
	}

	public String getWhere() {
		return where;
	}

	public void setWhere(String where) {
		this.where = where;
	}

	public Class<?> getClassName() {
		return ClassName;
	}

	public void setClassName(Class<?> className) {
		ClassName = className;
	}

	public boolean isIfEhcache() {
		return IfEhcache;
	}

	public void setIfEhcache(boolean ifEhcache) {
		IfEhcache = ifEhcache;
	}

	public Object getSuccess() {
		return Success;
	}

	public void setSuccess(Object success) {
		Success = success;
	}

	/**
	 * 獲取當前this
	 */
	// public DaoFrameDMLBaseTransmission(Object object) {
	//
	// setThisObject(object);
	// }
	//
	// public Object getThisObject() {
	// return thisObject;
	// }
	//
	// public void setThisObject(Object thisObject) {
	// this.thisObject = thisObject;
	// }

	public Boolean getPagingParametersCount() {
		return pagingParametersCount;
	}

	public void setPagingParametersCount(Boolean pagingParametersCount) {
		this.pagingParametersCount = pagingParametersCount;
	}

	public DaoFrameDMLBaseImpl() {
	}

	public DaoFrameDMLBaseImpl(String front, String tableName, String where, Class<?> className, boolean ifEhcache,
			Boolean pagingParametersCount) {
		DataBase = SqlDataBaseController.getDataBase();
		DML = SqlDataBaseController.getDMLSele();
		Front = SqlDataBaseController.getFront();
		if (!WhetherToEmpty.StringWhetherToEmpty(Front)) {
			Front = front;
		}
		Rule = SqlDataBaseController.getRule();
		TableName = tableName;
		this.where = SqlDataBaseController.getWhere();
		if (!WhetherToEmpty.StringWhetherToEmpty(where)) {
			this.where = where;
		}
		ClassName = className;
		IfEhcache = ifEhcache;
		this.pagingParametersCount = pagingParametersCount;
		this.IfUpdate = false;
	}

	public DaoFrameDMLBaseImpl(String front, String tableName, String where, Class<?> className, boolean ifEhcache,
			Boolean pagingParametersCount, int size, int page, String order, String descOrAsc) {
		DataBase = SqlDataBaseController.getDataBase();
		DML = SqlDataBaseController.getDMLSele();
		Front = SqlDataBaseController.getFront();
		if (!WhetherToEmpty.StringWhetherToEmpty(front)) {
			Front = front;
		}
		Rule = SqlDataBaseController.getRule();
		TableName = tableName;
		this.where = SqlDataBaseController.getWhere();
		if (!WhetherToEmpty.StringWhetherToEmpty(where)) {
			this.where = where;
		}
		ClassName = className;
		IfEhcache = ifEhcache;
		this.pagingParametersCount = pagingParametersCount;
		this.page = page;
		this.size = size;
		this.order = order;
		this.descOrAsc = descOrAsc;
		this.IfUpdate = false;
	}

	public DaoFrameDMLBaseImpl(String front, String tableName, String where, Class<?> className, boolean ifEhcache,
			Boolean pagingParametersCount, int size, int page, String order, String descOrAsc, int position) {
		DataBase = SqlDataBaseController.getDataBase();
		DML = SqlDataBaseController.getDMLSele();
		Front = SqlDataBaseController.getFront();
		if (!WhetherToEmpty.StringWhetherToEmpty(front)) {
			Front = front;
		}
		Rule = SqlDataBaseController.getRule();
		TableName = tableName;
		this.where = SqlDataBaseController.getWhere();
		if (!WhetherToEmpty.StringWhetherToEmpty(where)) {
			this.where = where;
		}
		ClassName = className;
		IfEhcache = ifEhcache;
		this.pagingParametersCount = pagingParametersCount;
		this.page = page;
		this.size = size;
		this.order = order;
		this.descOrAsc = descOrAsc;
		this.position = position;
		this.IfUpdate = false;
	}

	/**
	 * ----------------- 增刪改 參數方法-------------------
	 */

	public <T> DaoFrameDMLBaseImpl(T_SQLConditionEnum DmlT, String front, String tableName, String where,
			List<T> values2, boolean isReturnId, Object Mapping, Class<T> class1) {
		DataBase = SqlDataBaseController.getDataBase();
		DML = DmlT.getValue();
		if (!WhetherToEmpty.StringWhetherToEmpty(front)) {
			Front = front;
		}
		TableName = tableName;
		if (!WhetherToEmpty.StringWhetherToEmpty(where)) {
			this.where = where;
		}
		this.IfEhcache = false;
		this.pagingParametersCount = false;
		IfUpdate = true;
		this.values = values2;
		this.class1 = class1;
		this.MappingObject = Mapping;
		this.isReturnId = isReturnId;
	}

	public DaoFrameDMLBaseImpl getDaoFrameTrans() {
		return this;
	}
}
